package cn.wolfcode.luowowo.mgrsite.controller;

import cn.wolfcode.luowowo.acticle.domain.StrategyTheme;
import cn.wolfcode.luowowo.acticle.query.StrategyThemeQueryObject;
import cn.wolfcode.luowowo.acticle.service.IStrategyThemeService;
import cn.wolfcode.luowowo.common.util.AjaxResult;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 攻略主题资源管理器
 */
@Controller
@RequestMapping("/strategyTheme")
public class StrategyThemeController {
    @Reference
    private IStrategyThemeService strategyThemeService;

    //大攻略主题列表
    @RequestMapping("/list")
    public String list(Model model, @ModelAttribute("qo") StrategyThemeQueryObject qo){
        PageInfo pageInfo = strategyThemeService .query(qo);
        model.addAttribute("pageInfo", pageInfo);
        return "strategyTheme/list";
    }
    
    //保存攻略主题
    @RequestMapping("/saveOrUpdate")
    @ResponseBody
    public Object saveOrUpdate(StrategyTheme strategyTheme){
        strategyThemeService.saveOrUpdate(strategyTheme);
        return new AjaxResult();
    }
    //删除攻略主题
    @RequestMapping("/delete")
    @ResponseBody
    public Object delete(Long id){
        strategyThemeService.delete(id);
        return new AjaxResult();
    }
}
